/* 
 * Copyright [2018] [Alex/libo(liboware@gmail.com)]
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.hyts.infodb.config;

/** 
 * @author LiBo/Alex
 * @since V1.0
 * @version V1.0 
  *  文件枚举类型
 */
public enum FileTypeEnum {
    
    
    PDF("pdf"),
    WORD("doc|docx"),
    EXCEL("xls|xlsx"),
    POWERPOINT("ppt|pptx"),
    TEXT("txt"),
    MARKDOWN("md"),
    EXE("exe"),
    BAT("bat"),
    SHELL("sh"),
    JAVASCRIPT("js"),
    IMAGE("jpg|jpeg|gif");
    
    private String value;

    /**  
     * @constructor：FIleTypeEnum  
     * @param value  
     */ 
    private FileTypeEnum(String value) {
        this.value = value;
    }

    /**  
     * @name value's getter method
     * @param none
     * @return value
     */
    public String getValue() {
        return value;
    }

    /**  
     * @name value's setter method
     * @param value
     * @return void
     */
    public void setValue(String value) {
        this.value = value;
    }   

    /**  
     * @param fileType
     * @return
     * @exception
     */ 
    public static FileTypeEnum match(String fileType) {
        for(FileTypeEnum fileTypeElement: FileTypeEnum.values()) {
            if(fileTypeElement.getValue().contains(fileType)) {
                return fileTypeElement;
            }
        }
        return null;
    }   
}
